import {IAppInfo, GET_APP_INFO, UPDATE_APP_INFO} from './types';

// Actions
// 更新应用信息
export interface IUpdateAppInfoAction {
    type: UPDATE_APP_INFO,
    payload: IAppInfo
}

// 获取应用信息
export interface IGetAppInfoAction {
    type: GET_APP_INFO,
    payload: IAppInfo,
}

export type AppInfoAction = IUpdateAppInfoAction | IGetAppInfoAction;

// Action creators
export const updateAppInfoAction: (state: IAppInfo) => IUpdateAppInfoAction = (state: IAppInfo): IUpdateAppInfoAction => ({
    type: UPDATE_APP_INFO,
    payload: state,
});

export const getAppInfoAction: () => IGetAppInfoAction = (): IGetAppInfoAction => ({
    type: GET_APP_INFO,
    payload: {
        appId: '',
        appSecret: ''
    },
});


